package com.itheima10;

import java.math.BigDecimal;

/**
 * @author Xiao
 * @date 2021/7/20
 */
public class BigDecimalDemo01 {
    /**
     *  BigDecimal
     */
    public static void main(String[] args) {
        BigDecimal bd1 = new BigDecimal(10.2);
        BigDecimal bd2 = new BigDecimal(10.3);
        BigDecimal bd3 = new BigDecimal("10.2");
        BigDecimal bd4 = new BigDecimal("10.3");
        System.out.println(bd1.add(bd2));
        System.out.println(bd3.add(bd4));
        System.out.println("----------");
/*        System.out.println(bd1);     //10
        System.out.println(bd3);        //0.5
        System.out.println("----------");
        BigDecimal add = bd1.add(BigDecimal.valueOf(1.5));   //11.5
        BigDecimal add1 = bd1.add(bd3);   //10.5
        System.out.println(add);
        System.out.println(add1);
        System.out.println(bd1.subtract(bd3));   //9.5
        System.out.println(bd1.multiply(bd3));   //5.0
        System.out.println(bd1.divide(bd3));     //2E+1 → 20*/
    }
}
